﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Drawing;
namespace SXDXClient
{
    public class LEDClient
    {
        public LEDClient()
        {
            if (proxy == null)
            {
                proxy = new SXDBLClient();
            }
        }
        public SXDBLClient proxy = null;
        string result = "";
        string rawMessage = "";
        string command = "";
        int nScreenType = 1;
        int nWidth = 238;
        int nHeight = 32;
        Int64 leattime = 500;
        string szBmpName = "A1.jpg";
        byte[] imgbyte;
        Image img;
        string bmp = "";
        public static byte[] GetBytesByImage(System.Drawing.Image image)
        {
            byte[] photo_byte = null;
            using (MemoryStream ms = new MemoryStream())
            {
                Bitmap bmp = new Bitmap(image);
                bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                photo_byte = new byte[ms.Length];
                ms.Position = 0;
                ms.Read(photo_byte, 0, Convert.ToInt32(ms.Length));
                bmp.Dispose();
            }

            return photo_byte;
        }
        public byte[] ByteArrayFromBitmap(ref Bitmap bitmap)
        {
            // The bitmap contents are coded with Width and Height followed by pixel colors (uint)
            byte[] b = new byte[4 * (bitmap.Height * bitmap.Width + 2)];
            int n = 0;
            // encode the width
            uint x = (uint)bitmap.Width;
            int y = (int)x;
            b[n] = (byte)(x / 0x1000000);
            x = x % (0x1000000);
            n++;
            b[n] = (byte)(x / 0x10000);
            x = x % (0x10000);
            n++;
            b[n] = (byte)(x / 0x100);
            x = x % 0x100;
            n++;
            b[n] = (byte)x;
            n++;
            // encode the height
            x = (uint)bitmap.Height;
            y = (int)x;
            b[n] = (byte)(x / 0x1000000);
            x = x % (0x1000000);
            n++;
            b[n] = (byte)(x / 0x10000);
            x = x % (0x10000);
            n++;
            b[n] = (byte)(x / 0x100);
            x = x % 0x100;
            n++;
            b[n] = (byte)x;
            n++;
            // Loop through each row
            for (int j = 0; j < bitmap.Height; j++)
            {
                // Loop through the pixel on this row
                for (int i = 0; i < bitmap.Width; i++)
                {
                    x = (uint)bitmap.GetPixel(i, j).ToArgb();
                    y = (int)x;
                    b[n] = (byte)(x / 0x1000000);
                    x = x % (0x1000000);
                    n++;
                    b[n] = (byte)(x / 0x10000);
                    x = x % (0x10000);
                    n++;
                    b[n] = (byte)(x / 0x100);
                    x = x % 0x100;
                    n++;
                    b[n] = (byte)x;
                    n++;
                }
            }
            return b;
        }
 
        public void EncodeDateTime(ref TSystemTime t, ushort year, ushort month, ushort day, ushort hour, ushort minute, ushort second, ushort milliseconds)
        {
            t.wYear = year;
            t.wMonth = month;
            t.wDay = day;
            t.wHour = hour;
            t.wMinute = minute;
            t.wSecond = second;
            t.wMilliseconds = milliseconds;
        }
        public int MonthDays(int ryear, int month)
        {
            int r = 0;
            switch (ryear)
            {
                case 0:
                    switch (month)
                    {
                        case 0:
                        case 2:
                        case 4:
                        case 6:
                        case 7:
                        case 9:
                        case 11:
                            r = 31;
                            break;
                        case 3:
                        case 5:
                        case 8:
                        case 10:
                            r = 30;
                            break;
                        case 1:
                            r = 28;
                            break;
                    }
                    break;
                case 1:
                    switch (month)
                    {
                        case 0:
                        case 2:
                        case 4:
                        case 6:
                        case 7:
                        case 9:
                        case 11:
                            r = 31;
                            break;
                        case 3:
                        case 5:
                        case 8:
                        case 10:
                            r = 30;
                            break;
                        case 1:
                            r = 29;
                            break;
                    }
                    break;
            }
            return r;
        } 
        #region====Control=====
        ///1.0 LED_Startup()初始化动态链接库。服务会装载动态链接库，为每一个LED创建一个实例。动态链接库的卸载，会在服务退出时自动进行。
        /// 如果多个客户端访问一个服务，服务仅装载一次。
        public string LED_Startup(int reset = 0)
        {
            #region=======4.9 LED_Startup================
            command = "LED_Startup";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<RESETDATA>" + reset + "</RESETDATA>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
            return result;
        }
        ///LED_Registration注册屏幕信息到服务器本地数据
        public void LED_Registration(int nLEDID, string prefix, string number, string ip, string mac, string devtyp, string bit, string locport, string comport, string stype,
            string rmtport, string dstAdd, string width, string height)
        {
            #region=======3.7 LED_RegLED-LED03================
            // 3.6. 截图
            //可以通过中心管理平台，发送截图指令，将当前LED的显示内容以图片的方式返回。
            command = "LED_Registration";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +//命令
                  "<LEDID>" + nLEDID + "</LEDID>" +///屏ID
                  "<LLLEDPRE> " + prefix + "</LLLEDPRE>" +//前缀(可选)
                  "<LLLEDNUMBER>" + number + "</LLLEDNUMBER>" +//名称(可选)
                  "<MACADDRESS>" + mac + "</MACADDRESS>" +//MAC地址(可选)
                  "<IPADDRESS>" + ip + "</IPADDRESS>" +//IP地址
                  "<DEVTYPE>" + devtyp + "</DEVTYPE>" +//设备类型
                // DEVICE_TYPE_COM  //串口通讯
                //DEVICE_TYPE_UDP   //网络通讯
                //DEVICE_TYPE_485  //485通讯
                  "<DSPEED>" + bit + "</DSPEED>" +
                //串口或者485通讯使用得通讯速度(波特率)    SBR_57600/SBR_38400/SBR_19200/SBR_9600 = 3;
                //	仅对RS-232和485 有效，一般情况下主板的速度为 SBR_57600     
                // UDP模式为自适应 最大3.5MBPS
                  "<LOCPORT>" + locport + "</LOCPORT>" +
                //对RS-232设备和半双工485设备，该参数为串口号      
                //对UDP设备，该参数为本地端口号，一般该值为大于1024的数字或者0,由系统自动分配
                  "<COMPORT>" + comport + "</COMPORT>" +
                //默认1，无需使用。
                  "<LLSCREENTYPE>" + stype + "</LLSCREENTYPE>" +
                //显示屏基色类型
                //SCREEN_UNICOLOR:   单色显示屏
                //SCREEN_COLOR:       双色显示屏
                //SCREEN_FULLCOLOR:  全彩色256级灰度显示屏
                //SCREEN_GRAY:         双基色256级灰度显示屏
                  "<REMOTPORT>" + rmtport + "</REMOTPORT>" +
                //仅对UDP方式有效，主板的固定端口为: 6666  不可以更改
                  "<DSTADD>" + dstAdd + "</DSTADD>" +
                //屏幕地址，一般为1
                  "<WIDTH>" + width + "</WIDTH>" +
                //屏幕宽点阵
                  "<HEIGHT>" + height + "</HEIGHT>" +
                //屏幕高点阵
                  "<NEWDATE>20130527</NEWDATE>" +
                //新建日期
                  "<NEWUSER>SUN</NEWUSER>" +
                //新建用户
                   "<LASTDATE>20130527</LASTDATE>" +
                //修改日期
                  "<LASTUSER>SUN</LASTUSER>" +
                  "</SXDData>";
            //修改用户
            result = proxy.GetInfo(rawMessage);
            #endregion 

        }
        public string LED_AdjustTime(int nLEDID)
        {
            command = "LED_AdjustTime";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        //LED_GetBright
        /// <summary>
        /// 设定亮度
        /// </summary>
        /// <param name="nLEDID"></param>
        /// <returns></returns>
        public string LED_GetBright(int nLEDID)
        {
            command = "LED_GetBright";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);

            return result;
        }
        /// 设定亮度LED_SetBright
        /// <param name="nLEDID"></param>
        /// <param name="nBright"></param>
        /// <returns></returns>
        public string LED_SetBright(int nLEDID, int nBright)
        {
            #region============LED_GetBright================
            command = "LED_SetBright";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +//屏ID
                  "<LEDID>" + nLEDID + "</LEDID>" +//屏ID
                  "<BRIGHT>" + nBright + "</BRIGHT>" +//亮度0-7  0=最暗   7=最亮
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
            Console.Write(rawMessage);
            Console.WriteLine("Press anyKey to continue....");
            Console.Read();
            return result;
        }
        /// <summary>
        /// 返回值1代表开机，0代表关机
        /// </summary>
        /// <param name="nLEDID"></param>
        /// <returns></returns>
        public string LED_GetPower(int nLEDID)
        {
            #region============LED_GetPower================
            command = "LED_GetPower";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
            return result;
        }
        public string LED_ResetDisplay(int nLEDID)
        {
            #region============LED_GetPower================
            command = "LED_ResetDisplay";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
            return result;
        }        
        /// <summary>
        /// 获取服务器端注册的LED列表
        /// </summary>
        /// <returns></returns>
        public string LED_GetLEDList()
        {
            #region=======4.9 LED_GetLEDList================
            command = "LED_GetLEDList";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
            return result;
        }
        /// <summary>
        /// 主要参数是屏幕的ID（nLEDID），
        /// 电源开关（nTurnOn），以及是否携带IP地址返回（nShowIP）
        /// nLEDID: 根据屏幕的注册ID，比如1，代表192.169.0.101IP地址的屏幕.
        /// nTurnOn: 0代表关机，1代表开机
        /// nShowIP: 如果是1，返回字符串将包含IP地址
        public string SwithPower(int nLEDID, int nTurnOn, int nShowIP)
        {
            command = "LED_SetPower";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<POWER>" + nTurnOn + "</POWER>" +
                  "</SXDData>";
            if (nShowIP == 1)
            {
                rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                    "<SXDData>" +
                    "<COMMAND>" + command + "</COMMAND>" +
                    "<LEDID>" + nLEDID + "</LEDID>" +
                    "<POWER>" + nTurnOn + "</POWER>" +
                    "<OUTPUTIP>" + nShowIP + "</OUTPUTIP>" +
                    "</SXDData>";
            }
            result = proxy.GetInfo(rawMessage);
            Console.WriteLine("Power change LED=" + nLEDID);
            Console.WriteLine("Press anyKey to continue....");
            Console.Read();
            return result;
        }
        public string LED_GetText(int iTextID)
        {
            #region============LED_GetPower================
            command = "LED_GetText";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<TEXTID>" + iTextID + "</TEXTID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
            return result;
        }
        public string LED_GetFont(int iID)
        {
            #region============LED_GetPower================
            command = "LED_GetFont";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<FONTID>" + iID + "</FONTID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
            return result;
        }
        #endregion
        #region====Prog=====
        //第1步 定义显示数据
        //调用该函数将会清除上次形成的数据，创建新的显示数据
        public string LED_MakeRoot(int nLEDID, string RootType, string ColorMode, string survive)
        {
            command = "LED_MakeRoot";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<ROOTTYPE>" + RootType + "</ROOTTYPE>" +
                  "<COLORMODE>" + ColorMode + "</COLORMODE>" +
                  "<SURVIVE>" + survive + "</SURVIVE>" +
                  "</SXDData>";
            //ROOTTYPE
            //ROOT_PLAY:  仅用于播放
            //ROOT_DOWNLOAD:  保存并播放，由于主板上有Flash芯片，因此可将显示内容保存在主板上，当断电重新启动时，显示屏可显示上次发送的数据（由于Flash有一定的写入次数限制，因此如果没有必要请不要用ROOT_DOWNLOAD）
            //	COLORMODE" 由于显示屏类型众多，每种显示屏的显示数据都不一样，因此必须指定相应的显示屏类型
            //SCREEN_UNICOLOR:   单色显示屏
            //SCREEN_COLOR:       双色显示屏
            //SCREEN_FULLCOLOR:  全彩色256级灰度显示屏
            //SCREEN_GRAY:         双基色256级灰度显示屏
            // SURVIVE 为RAM节目生存时间，在RootType=ROOT_PLAY时有效，当RAM节目播放达到时间后，恢复显示FLASH中的节目
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        //第二步: LED_AddChapter添加节目 
        public string LED_AddChapter(int nLEDID, int num, UInt32 time, string wait)
        {
            command = "LED_AddChapter";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +//节目数据缓冲区编号，是MakeRoot的返回值     
                  "<TIME>" + time + "</TIME>" +//播放的时间长度(单位为毫秒)  
                  "<WAIT>" + wait + "</WAIT>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        /// <summary>
        /// //第三步:   LED_AddRegion添加区域/分区 
        /// </summary>
        /// <param name="nLEDID"></param>
        /// <param name="num"></param>
        /// <param name="left"></param>
        /// <param name="top"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="border"></param>
        public void LED_AddRegion(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 border)
        {
            command = "LED_AddRegion";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +//  PNUM 节目数据缓冲区编号，是MakeRoot、MakeChapter的返回值                
                  "<STARTX>" + left + "</STARTX>" +//STARTX 左  
                  "<STARTY>" + top + "</STARTY>" +//上
                  "<WIDTH>" + width + "</WIDTH>" +//宽
                  "<HEIGHT>" + height + "</HEIGHT>" +//高
                  "<BORDER>" + border + "</BORDER>" +//边框=0
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
        }
        public string LED_AddText(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, string str, string fontname, Int32 fontsize, Int32 fontcolor, string fontstyle, Int32 wordwrap, Int32 alignment, Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            command = "LED_AddText";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<TEXT>" + str + "</TEXT>" +
                  "<FONTNAME>" + fontname + "</FONTNAME>" +
                  "<FONTSIZE>" + fontsize + "</FONTSIZE>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTSTYLE>" + fontstyle + "</FONTSTYLE>" +
                  "<WORDWRAP>" + wordwrap + "</WORDWRAP>" +
                  "<ALIGNMENT>" + alignment + "</ALIGNMENT>" +
                  "<INMETHOD>" + inmethod + "</INMETHOD>" +
                  "<INSPEED>" + inspeed + "</INSPEED>" +
                  "<OUTMETHOD>" + outmethod + "</OUTMETHOD>" +
                  "<OUTSPEED>" + outspeed + "</OUTSPEED>" +
                  "<STOPMETHOD>" + stopmethod + "</STOPMETHOD>" +
                  "<STOPSPEED>" + stopspeed + "</STOPSPEED>" +
                  "<STOPTIME>" + stoptime + "</STOPTIME>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
            /*
             * num 节目数据缓冲区编号，是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值 
             * lef:左top :上 width宽height高          
             * transparent 是否透明 =1表示透明；=0表示不透明            
             * border 流水边框(未实现)
             * str文字字符串
             * fontname 字体名称
             * fontsize 字体大小  
             * fontcolor 字体颜色 
             * fontstyle 字体样式 举例：=WFS_BOLD表示粗体；=WFS_ITALIC表示斜体；=WFS_BOLD+WFS_ITALIC表示粗斜体 
             * wordwrap 是否自动换行 =1自动换行；=0不自动换行
             * inmethod 引入方式(下面有列表说明) 
             * inspeed 引入速度(取值范围0-5，从快到慢) 
             * outmethod 引出方式(下面有列表说明)     
             * outspeed 引出速度(取值范围0-5，从快到慢)     
             * stopmethod 停留方式(下面有列表说明) 
             * stopspeed 停留速度(取值范围0-5，从快到慢) 
             * stoptime 停留时间(单位毫秒) 

             */
        }
        public string LED_MakeChapter(int nLEDID, string RootType, string ActionMode, Int32 ChapterIndex,string ColorMode, UInt32 time, string wait)
        {
            //(nLEDID, "ROOT_PLAY_CHAPTER", "ACTMODE_REPLACE", 0, "COLOR_MODE_DOUBLE", 5000, "WAIT_CHILD");
            command = "LED_MakeChapter";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<ROOTTYPE>" + RootType + "</ROOTTYPE>" +
                  "<ACTIONMODE>" + ActionMode + "</ACTIONMODE>" +
                  "<CHAPTERINDEX>" + ChapterIndex + "</CHAPTERINDEX>" +
                  "<COLORMODE>" + ColorMode + "</COLORMODE>" +
                  "<TIME>" + time + "</TIME>" +
                  "<WAIT>" + wait + "</WAIT>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        public string LED_MakeRegion(int nLEDID, string RootType, string ActionMode, Int32 ChapterIndex, Int32 RegionIndex,
           string ColorMode, Int32 left, Int32 top, Int32 width, Int32 height, Int32 border)
        {
            //return MakeLeaf(RootType, ActionMode, ChapterIndex, RegionIndex, LeafIndex, ColorMode, time, wait);
            command = "LED_MakeRegion";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<ROOTTYPE>" + RootType + "</ROOTTYPE>" +
                  "<ACTIONMODE>" + ActionMode + "</ACTIONMODE>" +
                  "<CHAPTERINDEX>" + ChapterIndex + "</CHAPTERINDEX>" +
                  "<REGIONINDEX>" + RegionIndex + "</REGIONINDEX>" +
                  "<COLORMODE>" + ColorMode + "</COLORMODE>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<BORDER>" + border + "</BORDER>" +       
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        //生成页面，后续需要调用[AddObject]->[AddWindows/AddDateTime等]
        //  RootType 必须设为ROOT_PLAY_LEAF
        //  ActionMode 必须设为0
        //  ChapterIndex 要更新的节目序号
        //  RegionIndex 要更新的区域/分区序号
        //  LeafIndex 要更新的页面序号
        //  ColorMode 同MakeRoot中的定义
        //  time 播放的时间长度
        //  wait 等待模式，=WAIT_CHILD，表示当达到播放时间长度时，需要等待子节目播放完成再切换；
        //                 =WAIT_USE_TIME，表示当达到播放时间长度时，不等待子节目播放完成，直接切换下一页面
        public string LED_MakeLeaf(int nLEDID, string RootType, string ActionMode, Int32 ChapterIndex, Int32 RegionIndex, Int32 LeafIndex,
        string ColorMode, UInt32 time, string wait)
        {
            //return MakeLeaf(RootType, ActionMode, ChapterIndex, RegionIndex, LeafIndex, ColorMode, time, wait);
            command = "LED_MakeLeaf";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<ROOTTYPE>" + RootType + "</ROOTTYPE>" +
                  "<ACTIONMODE>" + ActionMode + "</ACTIONMODE>" +
                  "<CHAPTERINDEX>" + ChapterIndex + "</CHAPTERINDEX>" +
                  "<REGIONINDEX>" + RegionIndex + "</REGIONINDEX>" +
                  "<LEAFINDEX>" + LeafIndex + "</LEAFINDEX>" +
                  "<COLORMODE>" + ColorMode + "</COLORMODE>" +
                  "<TIME>" + time + "</TIME>" +
                  "<WAIT>" + wait + "</WAIT>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        //生成播放对象，后续需要调用[AddWindows/AddDateTime等]
        //  RootType 必须设为ROOT_PLAY_LEAF
        //  ActionMode 必须设为0
        //  ChapterIndex 要更新的节目序号
        //  RegionIndex 要更新的区域/分区序号
        //  LeafIndex 要更新的页面序号
        //  ObjectIndex 要更新的对象序号
        //  ColorMode 同MakeRoot中的定义
        public string LED_MakeObject(int nLEDID, string RootType, string ActionMode, Int32 ChapterIndex, Int32 RegionIndex, Int32 LeafIndex, Int32 ObjectIndex, string ColorMode)
        {
            //return MakeObject(RootType, ActionMode, ChapterIndex, RegionIndex, LeafIndex, ObjectIndex, ColorMode);
            command = "LED_MakeObject";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<ROOTTYPE>" + RootType + "</ROOTTYPE>" +
                  "<ACTIONMODE>" + ActionMode + "</ACTIONMODE>" +
                  "<CHAPTERINDEX>" + ChapterIndex + "</CHAPTERINDEX>" +
                  "<REGIONINDEX>" + RegionIndex + "</REGIONINDEX>" +
                  "<LEAFINDEX>" + LeafIndex + "</LEAFINDEX>" +
                  "<OBJECTINDEX>" + ObjectIndex + "</OBJECTINDEX>" +
                  "<COLORMODE>" + ColorMode + "</COLORMODE>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;            
        }

        
        public string LED_AddChapterEx(int nLEDID, int num, UInt32 time, string wait, ushort kind, ushort week, Int32 stime, Int32 sdate, Int32 etime, Int32 edate)
        {
            #region============LED_LEDScreenInit================
            command = "LED_AddChapterEx";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<TIME>" + time + "</TIME>" +
                  "<WAIT>" + wait + "</WAIT>" +
                  "<KIND>" + kind + "</KIND>" +
                  "<WEEK>" + week + "</WEEK>" +
                  "<STIME>" + stime + "</STIME>" +
                  "<SDATE>" + sdate + "</SDATE>" +
                  "<ETIME>" + etime + "</ETIME>" +
                  "<EDATE>" + edate + "</EDATE>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
            return result;
        }
        
        public string LED_AddLeaf(int nLEDID, int num, UInt32 time, string wait)
        {
            command = "LED_AddLeaf";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<TIME>" + time + "</TIME>" +
                  "<WAIT>" + wait + "</WAIT>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        
        public void LED_AddTextEx(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
         string str, string fontname, Int32 fontsize, Int32 fontcolor, string fontstyle, Int32 wordwrap, Int32 vertical, Int32 alignment, Int32 verticalspace,
         Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            command = "LED_AddTextEx";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<TEXT>" + str + "</TEXT>" +
                  "<FONTNAME>" + fontname + "</FONTNAME>" +
                  "<FONTSIZE>" + fontsize + "</FONTSIZE>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTSTYLE>" + fontstyle + "</FONTSTYLE>" +
                  "<WORDWRAP>" + wordwrap + "</WORDWRAP>" +
                  "<VERTICAL>" + vertical + "</VERTICAL>" +
                  "<ALIGNMENT>" + alignment + "</ALIGNMENT>" +
                  "<VERTICALSPACE>" + verticalspace + "</VERTICALSPACE>" +
                  "<INMETHOD>" + inmethod + "</INMETHOD>" +
                  "<INSPEED>" + inspeed + "</INSPEED>" +
                  "<OUTMETHOD>" + outmethod + "</OUTMETHOD>" +
                  "<OUTSPEED>" + outspeed + "</OUTSPEED>" +
                  "<STOPMETHOD>" + stopmethod + "</STOPMETHOD>" +
                  "<STOPSPEED>" + stopspeed + "</STOPSPEED>" +
                  "<STOPTIME>" + stoptime + "</STOPTIME>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
        }

        public string LED_AddWindow(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
    string picture, Int32 src_width, Int32 src_height, Int32 alignment,
    Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            command = "LED_AddWindow";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<PICTURE>" + picture + "</PICTURE>" +
                  "<SWIDTH>" + src_width + "</SWIDTH>" +
                  "<SHEIGHT>" + src_height + "</SHEIGHT>" +
                   "<ALIGNMENT>" + alignment + "</ALIGNMENT>" +
                  "<INMETHOD>" + inmethod + "</INMETHOD>" +
                  "<INSPEED>" + inspeed + "</INSPEED>" +
                  "<OUTMETHOD>" + outmethod + "</OUTMETHOD>" +
                  "<OUTSPEED>" + outspeed + "</OUTSPEED>" +
                  "<STOPMETHOD>" + stopmethod + "</STOPMETHOD>" +
                  "<STOPSPEED>" + stopspeed + "</STOPSPEED>" +
                  "<STOPTIME>" + stoptime + "</STOPTIME>" +
                       "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }

        public string LED_AddPicture(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
    string picture,  Int32 alignment,
    Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            command = "LED_AddPicture";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<PICTURE>" + picture + "</PICTURE>" + 
                   "<ALIGNMENT>" + alignment + "</ALIGNMENT>" +
                  "<INMETHOD>" + inmethod + "</INMETHOD>" +
                  "<INSPEED>" + inspeed + "</INSPEED>" +
                  "<OUTMETHOD>" + outmethod + "</OUTMETHOD>" +
                  "<OUTSPEED>" + outspeed + "</OUTSPEED>" +
                  "<STOPMETHOD>" + stopmethod + "</STOPMETHOD>" +
                  "<STOPSPEED>" + stopspeed + "</STOPSPEED>" +
                  "<STOPTIME>" + stoptime + "</STOPTIME>" +
                       "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }

        public string LED_AddMovie(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
string picture, Int32 stretch)
        {
            command = "LED_AddMovie";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<PICTURE>" + picture + "</PICTURE>" +
                   "<STRETCH>" + stretch + "</STRETCH>" +               
                       "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        } 

        public void LED_AddDateTimeEx(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
 Int32 vertical, string fontname, Int32 fontsize, Int32 fontcolor, string fontstyle, Int32 year_offset, Int32 month_offset, Int32 day_offset, Int32 sec_offset, string format)
        {
            command = "LED_AddDateTimeEx";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<VERTICAL>" + vertical + "</VERTICAL>" +
                  "<FONTNAME>" + fontname + "</FONTNAME>" +
                  "<FONTSIZE>" + fontsize + "</FONTSIZE>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTSTYLE>" + fontstyle + "</FONTSTYLE>" +
                  "<YEAR_OFFSET>" + year_offset + "</YEAR_OFFSET>" +
                  "<MONTH_OFFSET>" + month_offset + "</MONTH_OFFSET>" +
                  "<DAY_OFFSET>" + day_offset + "</DAY_OFFSET>" +
                  "<SEC_OFFSET>" + sec_offset + "</SEC_OFFSET>" +
                  "<FORMAT>" + format + "</FORMAT>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
        }
        public void LED_AddCounter(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
 string countertype, string format, string fontname, Int32 fontsize, Int32 fontcolor, string fontstyle, int time, int date)
        {
            command = "LED_AddDateTimeEx";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<COUNTERTYPE>" + countertype + "</COUNTERTYPE>" +
                     "<FORMAT>" + format + "</FORMAT>" +
                  "<FONTNAME>" + fontname + "</FONTNAME>" +
                  "<FONTSIZE>" + fontsize + "</FONTSIZE>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTSTYLE>" + fontstyle + "</FONTSTYLE>" +
                  "<TIME>" + time + "</TIME>" +

                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
        }

        public string LED_AddDateTime(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
 Int32 vertical, string fontname, Int32 fontsize, Int32 fontcolor, string fontstyle, Int32 year_offset, Int32 month_offset, Int32 day_offset, Int32 sec_offset, string format)
        {
            command = "LED_AddDateTime";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<VERTICAL>" + vertical + "</VERTICAL>" +
                  "<FONTNAME>" + fontname + "</FONTNAME>" +
                  "<FONTSIZE>" + fontsize + "</FONTSIZE>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTSTYLE>" + fontstyle + "</FONTSTYLE>" +
                  "<YEAR_OFFSET>" + year_offset + "</YEAR_OFFSET>" +
                  "<MONTH_OFFSET>" + month_offset + "</MONTH_OFFSET>" +
                  "<DAY_OFFSET>" + day_offset + "</DAY_OFFSET>" +
                  "<SEC_OFFSET>" + sec_offset + "</SEC_OFFSET>" +
                  "<FORMAT>" + format + "</FORMAT>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        public string LED_AddCampaign(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
 Int32 vertical, string fontname, Int32 fontsize, Int32 fontcolor, string fontstyle, string format, Int32 btime, Int32 bdate,
            Int32 ftime, Int32 fdate, Int32 ttime, Int32 tdate, Int32 step)
        {
            command = "LED_AddCampaign";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<VERTICAL>" + vertical + "</VERTICAL>" +
                  "<FONTNAME>" + fontname + "</FONTNAME>" +
                  "<FONTSIZE>" + fontsize + "</FONTSIZE>" +
                  "<FONTCOLOR>" + fontcolor + "</FONTCOLOR>" +
                  "<FONTSTYLE>" + fontstyle + "</FONTSTYLE>" +
                    "<FORMAT>" + format + "</FORMAT>" +
                  "<BTIME>" + btime + "</BTIME>" +
                  "<BDATE>" + bdate + "</BDATE>" +
                  "<FTIME>" + ftime + "</FTIME>" +
                  "<FDATE>" + fdate + "</FDATE>" +
                                    "<TTIME>" + ttime + "</TTIME>" +
                  "<TDATE>" + tdate + "</TDATE>" +
                  "<STEP>" + step + "</STEP>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        public string LED_AddClockEx2(int nLEDID, int num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, Int32 vertical, Int32 offset,
    UInt32 bkcolor, UInt32 bordercolor, UInt32 borderwidth, string bordershape,
    Int32 dotradius, Int32 adotwidth, UInt32 adotcolor, Int32 bdotwidth, UInt32 bdotcolor,
    UInt32 cdotvisible, Int32 cdotwidth, UInt32 cdotcolor,
    Int32 hourwidth, UInt32 hourcolor, Int32 minutewidth, UInt32 minutecolor, Int32 secondwidth, UInt32 secondcolor)
        {
            command = "LED_AddClockEx2";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<STARTX>" + left + "</STARTX>" +
                  "<STARTY>" + top + "</STARTY>" +
                  "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<TRANSPARENT>" + transparent + "</TRANSPARENT>" +
                 "<BORDER>" + border + "</BORDER>" +
                  "<VERTICAL>" + vertical + "</VERTICAL>" +
                  "<OFFSET>" + offset + "</OFFSET>" +
                  "<BKCOLOR>" + bkcolor + "</BKCOLOR>" +
                  "<BORDERCOLOR>" + bordercolor + "</BORDERCOLOR>" +
                  "<BORDERWIDTH>" + borderwidth + "</BORDERWIDTH>" +
                    "<BORDERSHAPE>" + bordershape + "</BORDERSHAPE>" +
                  "<DOTRADIUS>" + dotradius + "</DOTRADIUS>" +
                  "<ADOTWIDTH>" + adotwidth + "</ADOTWIDTH>" +
                  "<ADOTCOLOR>" + adotcolor + "</ADOTCOLOR>" +
                  "<BDOTWIDTH>" + bdotwidth + "</BDOTWIDTH>" +
                       "<BDOTCOLOR>" + bdotcolor + "</BDOTCOLOR>" +
                  "<CDOTVISIBLE>" + cdotvisible + "</CDOTVISIBLE>" +
                  "<CDOTWIDTH>" + cdotwidth + "</CDOTWIDTH>" +
                  "<CDOTCOLOR>" + cdotcolor + "</CDOTCOLOR>" +
                  "<HOURWIDTH>" + hourwidth + "</HOURWIDTH>" +
                  "<HOURCOLOR>" + hourcolor + "</HOURCOLOR>" +
                  "<MINUTEWIDTH>" + minutewidth + "</MINUTEWIDTH>" +
                  "<MINUTECOLOR>" + minutecolor + "</MINUTECOLOR>" +
                  "<SECONDWIDTH>" + secondwidth + "</SECONDWIDTH>" +
                  "<SECONDCOLOR>" + secondcolor + "</SECONDCOLOR>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }
        public void LED_Preview(int nLEDID, Int32 num, Int32 width, Int32 height, string previewfile)
        {

            #region============LED_LEDScreenInit================
            command = "LED_Preview";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                           "<WIDTH>" + width + "</WIDTH>" +
                  "<HEIGHT>" + height + "</HEIGHT>" +
                  "<FILE>" + previewfile + "</FILE>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
        }
        public string LED_SendToScreen(int nLEDID, int num,int zip)
        { 
            command = "LED_SendToScreen";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "<PNUM>" + num + "</PNUM>" +
                  "<ZIP>" + zip + "</ZIP>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage); 
            return result;
        }

        #endregion
        
        public void EndProg(int nLEDID)
        {
            #region============LED_EndProgram================
            command = "LED_EndProgram";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
        }
        public void Send2LED(int nLEDID)
        {
            #region============LED_SendToScreen================
            command = "LED_SendToScreen";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            #endregion
        }
        public void LED_SavePicture(string szBMP)
        {

            command = "LED_SavePicture";
            //Image img = System.Drawing.Image.FromFile("/home/sun/SXDFile/Temp/"+szBMP);
            img = System.Drawing.Image.FromFile("D:/SXDFile/Temp/" + szBMP);
            szBmpName = "A1.jpg";
            imgbyte = GetBytesByImage(img);
            img.Dispose();
            bmp = Convert.ToBase64String(imgbyte);
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                  "<COMMAND>" + command + "</COMMAND>" +
                  "<PICTURENAME>" + szBmpName + "</PICTURENAME>" +
                  "<PVALUE>" + bmp + "</PVALUE>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            Console.Write(rawMessage);
            Console.WriteLine("Press anyKey to continue....");
            Console.Read();
        }
    
        public string LED_GetPlayContent(int nLEDID)
        {
            command = "LED_GetPlayContent";
            rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                  "<SXDData>" +
                      "<COMMAND>" + command + "</COMMAND>" +
                  "<LEDID>" + nLEDID + "</LEDID>" +
                  "</SXDData>";
            result = proxy.GetInfo(rawMessage);
            return result;
        }

       
         
    }
}
